<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAttachmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('file_attachments', function (Blueprint $table) {
            $table->id()->comment('附件 id');

            $table->uuid('uuid')->comment('uuid');
            $table->unsignedTinyInteger('is_sound')->default(0)->comment('是否是音频：0文件1音频2视频');
            $table->unsignedTinyInteger('is_remote')->default(0)->comment('是否远程附件');
            $table->unsignedTinyInteger('is_approved')->default(1)->comment('是否合法');
            $table->string('attachment')->default('')->comment('文件系统生成的名称');
            $table->string('file_path')->default('')->comment('文件路径');
            $table->string('file_name')->default('')->comment('文件原名称');
            $table->unsignedInteger('file_size')->default(0)->comment('文件大小');
            $table->string('file_type')->default('')->comment('文件类型');
            $table->ipAddress('ip')->default('')->comment('ip 地址');

            $table->tenant();
            $table->createby();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('file_attachments');
    }
}
